import axios from 'axios'
// export const test = 'http://192.168.248.249:8090';
export const test = 'https://192.168.249.228:8000';
var headers = {}
export const post = (url, params) => {
  const res = axios({
    method: 'post',
    url: url,
    data: params,
    headers: {
      'Authorization':sessionStorage.token.replace("\"","").replace("\"","")
    }
  });
  return res
};


export const put = (url) => {
  const res = axios({
    method: 'put',
    url: url,
    data: params,
    headers: {
      'Authorization':sessionStorage.token.replace("\"","").replace("\"","")
    }
  });
  return res
};

export const get = (url) => {
  return axios({
    method: 'get',
    url: url,
    headers: {
      'Authorization':sessionStorage.token.replace("\"","").replace("\"","")
    }
  });
};

export const check = (res) => {
  console.log(res);
} 



export const security = params => { return axios.post('/v1/security/get',params).then(res => res.data) }

export const svgApi = params => { return axios.post('/v1/svgApi/svg',params).then(res => res.data) }

export const svgsingle = params => { return axios.post('/v1/svgApi/svgsingle',params).then(res => res.data) }

export const securityCheck = params => { return axios.post('/v1/security/check', params).then(res => res.data) }

export const securityToUser = params => { return axios.post('/v1/security/toUser', params).then(res => res.data) }

export const PressApi = params => { return axios.post('/v1/project/press', params).then(res => res.data) }


export const logQr = params => { return axios.post('/v1/security/logQr', params).then(res => res.data) }

export const ChecklogQr = params => { return axios.post('/v1/security/ChecklogQr', params).then(res => res.data) }


export const capCheck = params => { return axios.post('/v2/captcha/check', params).then(res => res.data) }



export const capGet = () => { return axios.get('/v2/captcha/get').then(res => res.data) }

export const requestApplist = params => { return post('v1/app/applist', params).then(res => res.data) }



// export const UserInfo = params => { return post('/v1/user/get', params,headers).then(res => res.data) }


export const fileUp = () => { return put("/v1/file/push").then(res => res.data) }

export const OcrApi = () => { return put("/v1/ocr/get").then(res => res.data) }

export const WoffApi = params => { return post("/v1/ocr/woff",params).then(res => res.data) }

export const AppGroup = () => { return get('v1/app/group').then(res => res.data) }

export const shortApi = params => { return post("/v2/tools/short",params).then(res => res.data) }

export const logApi = params => { return post("/v2/tools/long",params).then(res => res.data) }

export const ChannelCheck = params => { return post('/v1/thrift/CC', params).then(res => res.data) }

export const getrouter = params => { return post('/v1/permission/router', params).then(res => res.data) }


export const UserGroups = () => { return get('v1/user/userGroupList').then(res => res.data) }
export const searchUser = params => { return post('/v1/user/search',params).then(res => res.data) }
export const getUsers = params => { return post('/v1/user/getuser',params).then(res => res.data) }
export const userGroupById = params => { return post('/v1/user/userGroupById', params).then(res => res.data) }
export const UserInfo = params => { return post('/v1/user/get', params).then(res => res.data) }
export const changePw = params => { return post('/v1/user/changePw', params).then(res => res.data) }
export const edtior = params => { return post('/v1/user/edtior', params).then(res => res.data) }
export const requestLogin = params => { return axios.post('v1/user/login', params).then(res => res.data) }
